export class ScorePanel {
    score = 0
    level = 1
    scoreEle: HTMLElement
    levelEle: HTMLElement
    maxLevel: number // 最高等级
    upScore: number // 多少分升级
  
  
    constructor(maxLevel = 10, upScore = 10) {
      this.scoreEle = document.getElementById('score')!
      this.levelEle = document.getElementById('level')!
      this.maxLevel = maxLevel
      this.upScore = upScore
    }
  
    addScore() {
      this.scoreEle.innerHTML = ++this.score + ''
      if (this.score % this.upScore === 0) this.levelUp()
    }
    levelUp() {
      if (this.level < this.maxLevel) this.levelEle.innerHTML = ++this.level + ''
    }
  }
